/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jili.ubert.dao.recent;

import java.io.Serializable;
import com.baidu.bjf.remoting.protobuf.Codec;
import com.baidu.bjf.remoting.protobuf.ProtobufProxy;
import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;
import com.jili.ubert.code.CodeTool;
import java.io.IOException;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dragon
 */
@Entity
@Table(name = "recent_obj_etf")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "RecentObjETF.findAll", query = "SELECT r FROM RecentObjETF r"),
    @NamedQuery(name = "RecentObjETF.findById", query = "SELECT r FROM RecentObjETF r WHERE r.id = :id"),
    @NamedQuery(name = "RecentObjETF.findByListingDate", query = "SELECT r FROM RecentObjETF r WHERE r.listingDate = :listingDate"),
    @NamedQuery(name = "RecentObjETF.findByEtfid", query = "SELECT r FROM RecentObjETF r WHERE r.etfid = :etfid"),
    @NamedQuery(name = "RecentObjETF.findByObj", query = "SELECT r FROM RecentObjETF r WHERE r.obj = :obj"),
    @NamedQuery(name = "RecentObjETF.findByPrimaryObj", query = "SELECT r FROM RecentObjETF r WHERE r.primaryObj = :primaryObj"),
    @NamedQuery(name = "RecentObjETF.findByCashObj", query = "SELECT r FROM RecentObjETF r WHERE r.cashObj = :cashObj"),
    @NamedQuery(name = "RecentObjETF.findByName", query = "SELECT r FROM RecentObjETF r WHERE r.name = :name"),
    @NamedQuery(name = "RecentObjETF.findByMarketCode", query = "SELECT r FROM RecentObjETF r WHERE r.marketCode = :marketCode"),
    @NamedQuery(name = "RecentObjETF.findByFundManagementCompany", query = "SELECT r FROM RecentObjETF r WHERE r.fundManagementCompany = :fundManagementCompany"),
    @NamedQuery(name = "RecentObjETF.findByUnderlyingIndex", query = "SELECT r FROM RecentObjETF r WHERE r.underlyingIndex = :underlyingIndex"),
    @NamedQuery(name = "RecentObjETF.findByTradeUnit", query = "SELECT r FROM RecentObjETF r WHERE r.tradeUnit = :tradeUnit"),
    @NamedQuery(name = "RecentObjETF.findByEstimateCashCompoment", query = "SELECT r FROM RecentObjETF r WHERE r.estimateCashCompoment = :estimateCashCompoment"),
    @NamedQuery(name = "RecentObjETF.findByMaxCashRatio", query = "SELECT r FROM RecentObjETF r WHERE r.maxCashRatio = :maxCashRatio"),
    @NamedQuery(name = "RecentObjETF.findByPublish", query = "SELECT r FROM RecentObjETF r WHERE r.publish = :publish"),
    @NamedQuery(name = "RecentObjETF.findByCreation", query = "SELECT r FROM RecentObjETF r WHERE r.creation = :creation"),
    @NamedQuery(name = "RecentObjETF.findByRedemption", query = "SELECT r FROM RecentObjETF r WHERE r.redemption = :redemption"),
    @NamedQuery(name = "RecentObjETF.findByRecordeNum", query = "SELECT r FROM RecentObjETF r WHERE r.recordeNum = :recordeNum"),
    @NamedQuery(name = "RecentObjETF.findByCashComponent", query = "SELECT r FROM RecentObjETF r WHERE r.cashComponent = :cashComponent"),
    @NamedQuery(name = "RecentObjETF.findByNavPercu", query = "SELECT r FROM RecentObjETF r WHERE r.navPercu = :navPercu"),
    @NamedQuery(name = "RecentObjETF.findByNav", query = "SELECT r FROM RecentObjETF r WHERE r.nav = :nav"),
    @NamedQuery(name = "RecentObjETF.findByDividendPercu", query = "SELECT r FROM RecentObjETF r WHERE r.dividendPercu = :dividendPercu"),
    @NamedQuery(name = "RecentObjETF.findByOwnUserID", query = "SELECT r FROM RecentObjETF r WHERE r.ownUserID = :ownUserID"),
    @NamedQuery(name = "RecentObjETF.findByAlterUserID", query = "SELECT r FROM RecentObjETF r WHERE r.alterUserID = :alterUserID"),
    @NamedQuery(name = "RecentObjETF.findByCreateTime", query = "SELECT r FROM RecentObjETF r WHERE r.createTime = :createTime"),
    @NamedQuery(name = "RecentObjETF.findByTimeStamp", query = "SELECT r FROM RecentObjETF r WHERE r.timeStamp = :timeStamp")})
public class RecentObjETF implements Serializable {
	public static byte[] EnCode(RecentObjETF msg) throws IOException {
		Codec<RecentObjETF> Lcode = ProtobufProxy.create(RecentObjETF.class);
		return Lcode.encode(msg);
	}
	public static RecentObjETF DeCode(byte[] data) throws IOException {
	Codec<RecentObjETF> Lcode = ProtobufProxy.create(RecentObjETF.class);
		return Lcode.decode(data);
	}

    private static final long serialVersionUID = 1L;
    @Id
    //@GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    @Protobuf
	private Integer id;
    @Basic(optional = false)
    @Column(name = "ListingDate")
    @Temporal(TemporalType.DATE)
    private Date listingDate;
	@Protobuf
	private long listingDateL;
    @Basic(optional = false)
    @Column(name = "ETFID")
    @Protobuf
	private String etfid;
    @Basic(optional = false)
    @Column(name = "Obj")
    @Protobuf
	private String obj;
    @Column(name = "PrimaryObj")
    @Protobuf
	private String primaryObj;
    @Column(name = "CashObj")
    @Protobuf
	private String cashObj;
    @Column(name = "Name")
    private String name;
	@Protobuf
	private byte[] nameBit;
    @Column(name = "MarketCode")
    @Protobuf
	private String marketCode;
    @Column(name = "FundManagementCompany")
    private String fundManagementCompany;
	@Protobuf
	private byte[] fundManagementCompanyBit;
    @Column(name = "UnderlyingIndex")
    @Protobuf
	private String underlyingIndex;
    @Column(name = "TradeUnit")
    @Protobuf
	private Integer tradeUnit;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "EstimateCashCompoment")
    @Protobuf
	private Float estimateCashCompoment;
    @Column(name = "MaxCashRatio")
    @Protobuf
	private Float maxCashRatio;
    @Column(name = "Publish")
    @Protobuf
	private String publish;
    @Column(name = "Creation")
    @Protobuf
	private String creation;
    @Column(name = "Redemption")
    @Protobuf
	private String redemption;
    @Column(name = "RecordeNum")
    @Protobuf
	private Integer recordeNum;
    @Column(name = "CashComponent")
    @Protobuf
	private Float cashComponent;
    @Column(name = "NavPercu")
    @Protobuf
	private Float navPercu;
    @Column(name = "Nav")
    @Protobuf
	private Float nav;
    @Column(name = "DividendPercu")
    @Protobuf
	private Float dividendPercu;
    @Column(name = "OwnUserID")
    @Protobuf
	private String ownUserID;
    @Column(name = "AlterUserID")
    @Protobuf
	private String alterUserID;
    @Column(name = "CreateTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;
	//@Protobuf
//tprivate long createTimeL;
    @Column(name = "TimeStamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date timeStamp;
	//@Protobuf
	//private long timeStampL;

    public RecentObjETF() {
    }

    public RecentObjETF(Integer id) {
        this.id = id;
    }

    public RecentObjETF(Integer id, Date listingDate, String etfid, String obj) {
        this.id = id;
        this.listingDate = listingDate;
		this.listingDateL = CodeTool.DateToLong(listingDate);
        this.etfid = etfid;
        this.obj = obj;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getListingDate() {
        return listingDate;
    }

    public void setListingDate(Date listingDate) {
        this.listingDate = listingDate;
        this.setListingDateL(CodeTool.DateToLong(listingDate));
    }

    public String getEtfid() {
        return etfid;
    }

    public void setEtfid(String etfid) {
        this.etfid = etfid;
    }

    public String getObj() {
        return obj;
    }

    public void setObj(String obj) {
        this.obj = obj;
    }

    public String getPrimaryObj() {
        return primaryObj;
    }

    public void setPrimaryObj(String primaryObj) {
        this.primaryObj = primaryObj;
    }

    public String getCashObj() {
        return cashObj;
    }

    public void setCashObj(String cashObj) {
        this.cashObj = cashObj;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
		this.setNameBit(CodeTool.StringToBit(name));
    }

    public String getMarketCode() {
        return marketCode;
    }

    public void setMarketCode(String marketCode) {
        this.marketCode = marketCode;
    }

    public String getFundManagementCompany() {
        return fundManagementCompany;
    }

    public void setFundManagementCompany(String fundManagementCompany) {
        this.fundManagementCompany = fundManagementCompany;
		this.setFundManagementCompanyBit(CodeTool.StringToBit(fundManagementCompany));
    }

    public String getUnderlyingIndex() {
        return underlyingIndex;
    }

    public void setUnderlyingIndex(String underlyingIndex) {
        this.underlyingIndex = underlyingIndex;
    }

    public Integer getTradeUnit() {
        return tradeUnit;
    }

    public void setTradeUnit(Integer tradeUnit) {
        this.tradeUnit = tradeUnit;
    }

    public Float getEstimateCashCompoment() {
        return estimateCashCompoment;
    }

    public void setEstimateCashCompoment(Float estimateCashCompoment) {
        this.estimateCashCompoment = estimateCashCompoment;
    }

    public Float getMaxCashRatio() {
        return maxCashRatio;
    }

    public void setMaxCashRatio(Float maxCashRatio) {
        this.maxCashRatio = maxCashRatio;
    }

    public String getPublish() {
        return publish;
    }

    public void setPublish(String publish) {
        this.publish = publish;
    }

    public String getCreation() {
        return creation;
    }

    public void setCreation(String creation) {
        this.creation = creation;
    }

    public String getRedemption() {
        return redemption;
    }

    public void setRedemption(String redemption) {
        this.redemption = redemption;
    }

    public Integer getRecordeNum() {
        return recordeNum;
    }

    public void setRecordeNum(Integer recordeNum) {
        this.recordeNum = recordeNum;
    }

    public Float getCashComponent() {
        return cashComponent;
    }

    public void setCashComponent(Float cashComponent) {
        this.cashComponent = cashComponent;
    }

    public Float getNavPercu() {
        return navPercu;
    }

    public void setNavPercu(Float navPercu) {
        this.navPercu = navPercu;
    }

    public Float getNav() {
        return nav;
    }

    public void setNav(Float nav) {
        this.nav = nav;
    }

    public Float getDividendPercu() {
        return dividendPercu;
    }

    public void setDividendPercu(Float dividendPercu) {
        this.dividendPercu = dividendPercu;
    }

    public String getOwnUserID() {
        return ownUserID;
    }

    public void setOwnUserID(String ownUserID) {
        this.ownUserID = ownUserID;
    }

    public String getAlterUserID() {
        return alterUserID;
    }

    public void setAlterUserID(String alterUserID) {
        this.alterUserID = alterUserID;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
		//this.createTimeL = CodeTool.DateToLong(createTime);
    }

    public Date getTimeStamp() {
        return timeStamp;
    }

    public void setTimeStamp(Date timeStamp) {
        this.timeStamp = timeStamp;
		//this.timeStampL = CodeTool.DateToLong(timeStamp);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RecentObjETF)) {
            return false;
        }
        RecentObjETF other = (RecentObjETF) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jili.ubert.dao.recent.RecentObjETF[ id=" + id + " ]";
    }

    public long getListingDateL() {
        return listingDateL;
    }

    public void setListingDateL(long listingDateL) {
        this.listingDateL = listingDateL;
		this.listingDate = CodeTool.LongToDate(listingDateL);
    }

    public byte[] getNameBit() {
        return nameBit;
    }

    public void setNameBit(byte[] nameBit) {
        this.nameBit = nameBit;
		this.name = CodeTool.BitToString(nameBit);
    }

    public byte[] getFundManagementCompanyBit() {
        return fundManagementCompanyBit;
    }

    public void setFundManagementCompanyBit(byte[] fundManagementCompanyBit) {
        this.fundManagementCompanyBit = fundManagementCompanyBit;
		this.fundManagementCompany = CodeTool.BitToString(fundManagementCompanyBit);
    }
    
}
